<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ProjectLxRequest extends BaseFormRequest
{


    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'=> 'required|string',
            'gsid'=> 'required|exists:company,id',
            'start'=> 'required|date',
            'stop'=> 'required|date',
            'deptid'=>'required|exists:dept,id',
            'leader'=>'required|string',//负责人
            'leader_mobile'=>'required|string',//负责人电话
            'currency'=>'required|string',//币种
            'offer'=>'required|min:1',
            'cost'=>'required|min:1',
            'city'=>'required|string',
            'desc'=>'required|string',
            'seller'=>'required|string',//销售经理
            'seller_mobile'=>'required|string',//销售经理电话
            'customer'=>'required|string',//客户负责人
            'customer_mobile'=> 'required|string',//客户电话
            'id'=>'sometimes|nullable|integer|exists:project_lx,id'
        ];
    }

    public function messages()
    {
        return [
            'name.required'=>'项目名称不能为空',
            'gsid.required'=>'公司不能为空',
            'start.required'=>'开始时间不能为空',
            'stop.required'=>'结束时间不能为空',
            'deptid.required'=>'部门不能为空',
            'leader.required'=>'负责人不能为空',
            'leader_mobile.required'=>'负责人电话不能为空',
            'currency.required'=>'币种不能为空',
            'offer.required'=>'报价不能为空',
            'offer.min'=>'报价不能小于1.00',
            'cost.required'=>'成本不能为空',
            'cost.min'=>'成本不能小于1.00',
            'city.required'=>'城市不能为空',
            'desc.required'=>'备注不能为空',
            'seller.required'=>'销售经理不能为空',
            'seller_mobile.required'=>'销售经理电话不能为空',
            'customer.required'=>'客户对接不能为空',
            'customer_mobile.required'=>'客户电话不能为空',
        ];
    }
}
